    /**
     * 解析数据 示例 result=0 返回等号后面的数据，即0
     */
    function getAfterData(param) {
        if (!param && typeof(param) != "undefined" && param != 0) {
            return '';
        } else {
            var parAry = new Array();
            parAry = param.split('=');
            return parAry[1];
        }
    }

    const ReadIdNum = function(obj) {
        var cardStr = ZJRCEP.ReadIdCardInfo();//ZJRCEP <object id="ZJRCEP">
        if (cardStr.length == 0) {
            return obj.$message.error('读取身份证信息失败。');
        } else {
            var strs = cardStr.split("&");
            var result = getAfterData(strs[0]);
            if (result == 0) {
                let startData=getAfterData(strs[8])
                let endData=getAfterData(strs[9])
                let personInfo = {
                    name: getAfterData(strs[1]),
                    sex: getAfterData(strs[2]),
                    nationality: getAfterData(strs[3]),
                    birthday: getAfterData(strs[4]),
                    birthAddressDetail: getAfterData(strs[5]),
                    idcardNo: getAfterData(strs[6]),
                    // issueAuthority: getAfterData(strs[7]),
                    issueDate: startData.substring(0,4)+'-'+startData.substring(4,6)+'-'+startData.substring(6,8),
                    expiringDate: endData.substring(0,4)+'-'+endData.substring(4,6)+'-'+endData.substring(6,8),
                    personImg: 'data:image/jpeg;base64,' + getAfterData(strs[10]),
                }
                return personInfo
            } else if (result == -1) {
                return obj.$message.error('未找到附件库');
            } else if (result == -2) {
                return obj.$message.error('读卡失败');
            } else if (result == -3) {
                return obj.$message.error('获取卡片信息失败');
            } else if (result == -4) {
                return obj.$message.error('未找到读卡器');
            } else if (result == -6) {
                return obj.$message.error('未找到身份证卡片');
            } else if (result == 114) {
                return obj.$message.error('寻卡失败，请重新放置');
            } else {
                return obj.$message.error('其他错误');
            }
        }
    }
    export {
        ReadIdNum
    }